using System;

using LambdaGp.Core;

namespace LambdaGp.Operators.Functions
{
    public abstract class UnaryOperator : Operator
    {
        protected UnaryOperator(string name)
            : base(name)
        {
        }
        public override int Arity { get { return 1; } }
        public override Func<double> CompileToFunc(Individual individual, OperatorNode operatorNode)
        {
            Func<double> argument = operatorNode.Children[0].CompileToFunc(individual);
            return CompileUnaryToFunc(individual, argument);
        }
        protected abstract Func<double> CompileUnaryToFunc(Individual individual, Func<double> argument);
    }
}
